package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class operationReturn implements Ioperation {
    public void work(BookList bookList){
            System.out.println("借阅图书");
            System.out.println("请输入要借阅图书的名字:");
            Scanner in = new Scanner(System.in);
            String name = in.nextLine();
            int currentSize = bookList.getUsesize();
            for (int i = 0; i < currentSize; i++) {
                Book book = bookList.getbook(i);
                if (book.getName().equals(name)) {
                    book.setIsBorrow(false);
                    System.out.println("归还成功！");
                    return;
                }
            }
            System.out.println("归还失败！");

        }


}